<?php if (!defined('FIT_PATH')) exit('No direct script access allowed');
/**
 * @copyright 2009 - 2011 Bincent.com. All Rights Reserved.
 * @license http://www.apache.org/licenses/LICENSE-2.0
 * @package FitPHP
 * @subpackage core
 * 
 * @author Hongbin Hsu <hongbin.hsu@gmail.com> Initial.
 * @version $Id: core/base.php 1.0 2009-07-18 13:34 hongbin.hsu $
 */
 
// ------------------------------------------------------------------------

class Base
{
	private static $instance;
	
	//----------------------------------------------------------
	public function __construct()
	{
		self::$instance =& $this;
	}
	
	//----------------------------------------------------------
	public static function &get_instance()
	{
		return self::$instance;
	}
	
	//----------------------------------------------------------
	public function __set($name, $value)
	{
		if (property_exists($this, $name)) {
			$this->$name = $value;
		}
	}
	
	//----------------------------------------------------------
	public function __get($name)
	{
		return (isset($this->$name)) ? $this->$name : null;
	}

	//----------------------------------------------------------
    public function __call($method, $arguments)
    {
    	echo 'not find this function:'. $method;
    }
}

function &get_instance()
{
	return Base::get_instance();
}